package com.xuqing.autohelpertesting;

import android.app.Activity;
import android.view.View;

import androidx.fragment.app.Fragment;
import site.xuqing.autohelperengine.AutoHelper;

/**
 * @author xuqing
 * @Description 测试步骤
 * @createTime 2022年03月24日 10:58:44
 */
public class AutoHelperTesting {
    private static final class AutoHelperTestingHolder {
        public static final AutoHelperTesting INSTANCE = new AutoHelperTesting();
    }
    
    private AutoHelperTesting() {}
    
    public static AutoHelperTesting getInstance() {
        return AutoHelperTestingHolder.INSTANCE;
    }
    
    public void startTesting(Activity activity,Testing testing){
        testing.setActivity(activity);
        AutoHelper.getInstance().executeStep(activity,testing.getTesting());
    }
    
    public void startTesting(Fragment fragment, Testing testing){
        testing.setFragment(fragment);
        AutoHelper.getInstance().executeStep(fragment.getContext(),testing.getTesting());
    }
    
    public void startTesting(View view,Testing testing){
        testing.setView(view);
        AutoHelper.getInstance().executeStep(view.getContext(),testing.getTesting());
    }
}
